package org.ix.dynamicapis.model.request;

import org.ix.dynamicapis.constant.SortConstants;
import org.ix.dynamicapis.model.QueryRequest;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Collection;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@ApiModel(description = "多主键测试查询条件请求实体")
@Getter
@Setter
@ToString
public class ApiMultiConfigQueryRequest extends QueryRequest {

    @ApiModelProperty(value = "ConfigKey")
    private String configKey;

    @ApiModelProperty(value = "ConfigKey列表")
    private Collection<String> configKeyIn;

    @ApiModelProperty(value = "ConfigKey包含")
    private String configKeyContains;

    @ApiModelProperty(value = "ConfigType")
    private Integer configType;

    @ApiModelProperty(value = "ConfigType列表")
    private Collection<Integer> configTypeIn;

    @ApiModelProperty(value = "最小ConfigType")
    private Integer configTypeMin;

    @ApiModelProperty(value = "最大ConfigType")
    private Integer configTypeMax;

    public void setConfigKeySort(SortConstants sortConstants)  {
        super.orderBy("config_key", sortConstants);
    }

    public void getConfigKeySort()  {
        super.getOrderBy().getOrDefault("config_key", null);
    }

    public void setConfigTypeRange(Integer[] configTypeRange)  {
        if (configTypeRange == null || configTypeRange.length != 2) {
            return;
        }
        this.configTypeMin = configTypeRange[0];
        this.configTypeMax = configTypeRange[1];
    }

    public void setConfigTypeSort(SortConstants sortConstants)  {
        super.orderBy("config_type", sortConstants);
    }

    public void getConfigTypeSort()  {
        super.getOrderBy().getOrDefault("config_type", null);
    }
}
